package org.example.petitionplatformsystem.converter;

import org.example.petitionplatformsystem.dao.model.PetitionEvents;
import org.example.petitionplatformsystem.dto.PetitionDTO.PetitionPostDTO;

import java.time.LocalDateTime;

public class PetitionConverter {
    public static PetitionEvents toPetitionEvents(PetitionPostDTO petitionPostDTO){
        LocalDateTime now = LocalDateTime.now();
        PetitionEvents petitionEvents = new PetitionEvents();
        petitionEvents.setPetitionDep(petitionPostDTO.getInstitution());
        petitionEvents.setEventType(1L);
        petitionEvents.setUserID(petitionPostDTO.getUserid());
        petitionEvents.setDescription(petitionPostDTO.getDescription());
        petitionEvents.setStatus(0L);
        petitionEvents.setCreatedAt(String.valueOf(now));
        petitionEvents.setTitle(petitionPostDTO.getTitle());

        return petitionEvents;
    }
}
